<!DOCTYPE html>
<html lang="zc-CN">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .wang {
            color: lawngreen;
        }
    </style>
</head>

<body>
    <div class="the_div">
        <p>我是p标签</p>
        <h3>我是h3</h3>
        <h3>我是h3</h3>
        <h3>我是h3</h3>
        <a id="theA" href="#">我是一个a标签</a>
        <ul>
            <li>北京</li>
            <li>天津</li>
            <li>南京</li>
        </ul>
        <ol class="my_li">
            <li>大张</li>
            <li>大王</li>
            <li>大狗</li>
        </ol>
        <ul class="my_li">
            <li>小明</li>
            <li>小红</li>
            <li>小蓝</li>
        </ul>
    </div>
    <!-- 练习1. 通过id获取到a标签

    练习2. 通过标签名 获取到所有h3标签, 并输出在控制台

    练习3. 通过querySelectAll() 获取所有的li标签

    练习4. 通过querySelectAll() 获取所有小字开头的名字的li标签

    练习5. 给<li>小红</li> 内容改成小六，字体颜色变成红色

    练习6. 给<li>天津</li> 添加类名，样式修改背景色老绿 -->
    <script>
        // 1.
        const a = document.querySelector('#theA');
        // 2.
        const h3 = document.querySelectorAll('h3');
        console.log(h3);
        // 3.
        const lis = document.querySelectorAll('li');
        console.log(lis);
        // 4.
        const xiao = document.querySelectorAll('.my_li:last-child li');
        console.log(xiao);
        // 5.
        const red = document.querySelector('.my_li:last-child li:nth-child(2)');
        red.style.color = 'red'
        // 6.
        const tian = document.querySelector('ul li:nth-child(2)');
        console.log(tian);
        tian.classList.add('wang')
    </script>
</body>

</html>